#include <iostream>
#include <cassert>
#include "../src/asset/manager.h"
#include "../src/asset/model.h"

void testAssetManager() {
    AssetManager manager;
    Asset asset;
    
    // 测试初始状态
    assert(manager.getAssetCount() == 0);
    assert(!manager.getAssetById(1, asset));
    
    // 测试添加资产
    Asset newAsset;
    newAsset.name = "Test Asset";
    newAsset.type = "Test Type";
    newAsset.value = 100.0;
    
    int assetId = manager.addAsset(newAsset);
    assert(assetId == 1);
    assert(manager.getAssetCount() == 1);
    
    // 测试获取资产
    assert(manager.getAssetById(1, asset));
    assert(asset.name == "Test Asset");
    assert(asset.type == "Test Type");
    assert(asset.value == 100.0);
    
    // 测试更新资产
    asset.value = 200.0;
    asset.description = "Updated description";
    assert(manager.updateAsset(asset));
    
    Asset updatedAsset;
    assert(manager.getAssetById(1, updatedAsset));
    assert(updatedAsset.value == 200.0);
    assert(updatedAsset.description == "Updated description");
    
    // 测试删除资产
    assert(manager.deleteAsset(1));
    assert(manager.getAssetCount() == 0);
    assert(!manager.getAssetById(1, asset));
    
    std::cout << "All asset tests passed!" << std::endl;
}

int main() {
    testAssetManager();
    return 0;
}
